<?php

/**
 * A simple mobile site
 */
class Index extends UI_MobilePage {

    public function __construct() {
	parent::__construct();

	//Create a page
	$p = $this->createPage("Welcome");

	//Add a simple text
	$p->add(new UI_Text("Welcome to our site. "));

	//Create a main menu
	$menu = new UI_ListViewBox();

	//Create a submenu AboutUs. See the second parameter: $isSubList. Must be true
	$menuAboutUs = new UI_ListViewBox("About Us",true);

	//Add any content in submenu about us
	$menuAboutUs->add(new UI_Text("Lorem ipsum ...."));

	//Add the submenu about-us in the main menu.
	$menu->add($menuAboutUs);

	//Create a submenu *news*.
	$news = new UI_ListView("News",true);

	$news->add(new UI_ListView_ItemDivider("December/2010"));
	$news->add(new UI_ListView_Item("News 07","Lorem Ipsum blablabla"));
	$news->add(new UI_ListView_Item("News 06","Lorem Ipsum blablabla"));
	$news->add(new UI_ListView_Item("News 05","Lorem Ipsum blablabla"));
	$news->add(new UI_ListView_ItemDivider("November/2010"));
	$news->add(new UI_ListView_Item("News 04","Lorem Ipsum blablabla"));
	$news->add(new UI_ListView_Item("News 03","Lorem Ipsum blablabla"));
	$news->add(new UI_ListView_Item("News 02","Lorem Ipsum blablabla"));
	$news->add(new UI_ListView_ItemDivider("September/2010"));
	$news->add(new UI_ListView_Item("News 01","Lorem Ipsum blablabla"));

	//Add the news menu to a main menu
	$menu->add($news);


	//Now, lets create another page. This page needs a id (2o parameter)
	$p2 = $this->createPage("Contatct us", "contactus");
	$p2->add(new UI_Text("Fill the form and click 'send'"));

	//Links p1 to p2
	$menu->add(new UI_ListView_ItemLink("#contactus", "Contatc us", UI_Transition::POP));

	$p->add($menu);

	//create a form
	$form = new UI_Form($this->getUrl("examples:simplesite:sendemail"));
	$form->add(new UI_Form_TextInput("Your name", "Name"));
	$form->add(new UI_Form_TextInput("Your email", "Email"));
	$form->add(new UI_Form_TextArea("Message:", "Message"));

	$departaments = array("Financial","Marketing","Support");
	$form->add(new UI_Form_Select("To:", "Departament", $departaments));

	$sendToMe = array("Yes","No");
	$form->add(new UI_Form_Flip("Send to me?", "SendToMe", $sendToMe));

	$form->AddSubmit("Send");

	//Add form on p2
	$p2->add($form);


    }

}

?>